#include "thread.hpp"
#include <unistd.h>
#include <vector>

void Print()
{
    while (true)
    {
        sleep(1);
        cout << "哈哈,我是一个封装的线程..." << endl;
    }
}

int main()
{
    vector<Thread> threads;
    for (int i = 0; i < 10; i++)
    {
        threads.push_back(Thread(Print));
    }
    for (auto &e : threads)
    {
        e.Run();
    }
    for (auto &e : threads)
    {
        e.Join();
    }
    return 0;
}

template <typename T>
class Singleton
{
    static T *inst;

public:
    static T *GetInstance()
    {
        if (inst == NULL)
        {
            inst = new T();
        }
        return inst;
    }
};

/*
int main()
{

    Thread t(Print);
    t.Run();
    cout << "是否启动成功: " << t.IsRunning() << endl;
    cout << "启动的时间戳: " << t.StartTimestamp() << endl;
    cout << "线程的名字: " << t.Name() << endl;
    t.Join();
    return 0;
}
*/